package main1.f_Model;

import main.f_ProtorypeModel.ResumeDeep;
import main.f_ProtorypeModel.ResumeShallow;
import main.f_ProtorypeModel.WorkExperience;

/**
 * Created by newtranx_011 on 2017/9/22.
 */
public class Main {
    public static void main(String[] args) throws Exception {

//        shalowColne();

        deepColne();

    }

    public static void shalowColne() throws Exception{

        WorkExperience workExperience = new WorkExperience("小明", "1990");
        ResumeShallow resumeShallow = new ResumeShallow();
        resumeShallow.setName("A");
        resumeShallow.setWorkExperience(workExperience);

        ResumeShallow resumeShallow1 = (ResumeShallow)resumeShallow.clone();
        resumeShallow1.setName("B");

//        WorkExperience workExperience1 = new WorkExperience("小明2", "1991");
//        resumeShallow1.setWorkExperience(workExperience1);
        workExperience.setCompany("test");
        workExperience.setTime("1991");


        resumeShallow.show();
        resumeShallow1.show();

    }

    public static void deepColne() throws CloneNotSupportedException {

        WorkExperience workExperience = new WorkExperience("小明", "1990");
        ResumeDeep resumeDeep = new ResumeDeep();
        resumeDeep.setName("ADeep");
        resumeDeep.setWorkExperience(workExperience);

        ResumeDeep resumeDeep1 = (ResumeDeep)resumeDeep.clone();
        resumeDeep1.setName("BDeep");

//        WorkExperience workExperience1 = new WorkExperience("小明2", "1991");
//        resumeShallow1.setWorkExperience(workExperience1);
        workExperience.setCompany("test");
        workExperience.setTime("1991");


        resumeDeep.show();
        resumeDeep1.show();

    }
}
